<html>
<head>
<title>Edit a record of 活動</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link media="all" href="/cms/css/cms.min.css" type="text/css" rel="stylesheet" /> 
<link rel="stylesheet" type="text/css" href="/cms/css/tag/token-input.css" />
<script  type="text/javascript" src="/cms/js/cms.1.1.min.js"></script>
<script type="text/javascript" src="/cms/js/tag/jquery.tokeninput.js"></script>
<script language="JavaScript" src="/cms/js/cleditor/jquery.cleditor.min.js"></script>
<!--change to auto add JS later-->
<script language="JavaScript" src="/cms/js/jquery.validate.js"></script>
<script language="JavaScript" src="/cms/js/autocomplete/textarea.js"></script>

<link media="all" href="/cms/js/jcrop/css/jquery.Jcrop.css" type="text/css" rel="stylesheet"> 
</head>

<body>
{#include file="$navigation"#}
<div style="float:right;" id="login"></div>
<script>
$(document).ready(function() {	

});	
  function validate_form(form){
	  if (validator.form())  form.submit(); else alert('Some fields has error. Please check and resubmit');
  }
</script>

<H1><span id="parent_key_label"></span>Edit a record of  活動</H1>
<form name="form_edit" id="form_edit" method="post" action="{#$self_url#}" enctype="multipart/form-data">	
<div class='tableWrapper' style="width:100%;margin:0;padding:0;">
  <div class='tableHeader' >

	<ul class="tableActions">
	
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 儲存 " onclick="form.subaction.value='edit_after_update'; form.submit();" type="button"></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" type="submit" name="Submit" value=" 確定 "></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="dummy" value=" 取消 " onclick="javascript:window.location.href='{#$self_url#}/list'" type="button"></li>  
<li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 刪除 " onclick="form.action.value='del'; form.submit();" type="button"></li>其他功能(請先儲存)：<a href="javascript:window.location.href='/cms/builder/event/photo.php/list/{#$edit_data.id#}'">Photo</a>
<a href="javascript:window.location.href='/cms/builder/event/application.php/list/{#$edit_data.id#}'">Application</a>

<a href="javascript:window.location.href='/cms/builder/event/question.php/list/{#$edit_data.id#}'">問題/選項</a>

<a href="javascript:window.location.href='/cms/builder/event/user.php/list/{#$edit_data.id#}'">用戶</a>

	</ul>

  <div class='clear'></div>
  <div class='corner left'></div>
  <div class='corner right'></div>
  </div>	
	
<table border="0" cellspacing='0' >
<tr id="tr_id"><td><B>id</B></td>
<td id="td_id">{#$edit_data.id#}</td></tr>
<tr id="tr_title"><td><B>標題</B></td>
<td id="td_title"><input id="field_title" type="text" name="title" value="{#$edit_data.title#}"></td></tr>
<tr id="tr_starttime"><td><B>開始時間</B></td>
<td id="td_starttime"><input type="text" name="starttime" value="{#$edit_data.starttime#}" id="datepicker_starttime">
<script type="text/javascript">  
$(function() {  
    $('#datepicker_starttime').datepicker({  
        duration: '',  
        showTime: true,  
        constrainInput: false,  
        stepMinutes: 1,  
        stepHours: 1,          
        altTimeField: '',  
        dateFormat:'yy-mm-dd',
        time24h: true  
     });  
});  
</script>

</td></tr>
<tr id="tr_endtime"><td><B>結束時間</B></td>
<td id="td_endtime"><input type="text" name="endtime" value="{#$edit_data.endtime#}" id="datepicker_endtime">
<script type="text/javascript">  
$(function() {  
    $('#datepicker_endtime').datepicker({  
        duration: '',  
        showTime: true,  
        constrainInput: false,  
        stepMinutes: 1,  
        stepHours: 1,          
        altTimeField: '',  
        dateFormat:'yy-mm-dd',
        time24h: true  
     });  
});  
</script>

</td></tr>
<tr id="tr_event_type"><td><B>分類</B></td>
<td id="td_event_type">{#$edit_data.event_type#}</td></tr>
<tr id="tr_event_date_row_separator" style="background:#F5F5F5;"><td colspan="2" style="font-weight:bold;text-align:center;">活動日期及地點</td></tr>

<tr id="tr_event_date"><td><B>活動日期</B></td>
<td id="td_event_date"><input type="text" name="event_date" value="{#$edit_data.event_date#}" id="datepicker_event_date">
<script type="text/javascript">
	$(function() {
		$("#datepicker_event_date").datepicker(
		{dateFormat: 'yy-mm-dd', 
		    numberOfMonths: 2,
		    showOtherMonths: true, selectOtherMonths: true,
			changeMonth: true, changeYear: true,  
            showWeek: true,			
			showButtonPanel: true
          }
		);
	});
</script>
</td></tr>
<tr id="tr_event_time"><td><B>時間</B></td>
<td id="td_event_time"><input id="field_event_time" type="text" name="event_time" value="{#$edit_data.event_time#}"></td></tr>
<tr id="tr_place"><td><B>地點</B></td>
<td id="td_place"><input type="text" id="field_place" name="place"  size="80" value="{#$edit_data.place#}"></td></tr>
<tr id="tr_event_url"><td><B>url</B></td>
<td id="td_event_url"><input type="text" id="field_event_url" name="event_url"  size="80" value="{#$edit_data.event_url#}"></td></tr>
<tr id="tr_intro"><td><B>簡介</B></td>
<td id="td_intro"><textarea name="intro" id="field_intro" cols="80" rows="4">{#$edit_data.intro#}</textarea></td></tr>
<tr id="tr_has_detail"><td><B>已有活動報導</B></td>
<td id="td_has_detail">{#$edit_data.has_detail#}&nbsp;&nbsp;活動報導相片，請按 "PHOTO" 輸入。 </td></tr>
<tr id="tr_body"><td><B>活動報導詳細內容</B></td>
<td id="td_body"><textarea name="body" id="field_body" cols="80" rows="10">{#$edit_data.body#}</textarea></td></tr>
<tr id="tr_content_json"><td><B>json 花絮 圖片 等數據</B></td>
<td id="td_content_json">{#$edit_data.content_json#}</td></tr>
<tr id="tr_product"><td><B>產品id</B></td>
<td id="td_product"><input id="field_product" type="text" name="product" value="{#$edit_data.product#}"><BR/>產品id， 請以 “,” 分開<BR/>（註： 暫時請輸入以ID 輸入，之後會修改）</td></tr>
<tr id="tr_brand_str"><td><B>品牌名稱</B></td>
<td id="td_brand_str"><input type="text" id="field_brand_str" name="brand_str"  size="80" value="{#$edit_data.brand_str#}"></td></tr>
<tr id="tr_cover"><td><B>Event 封面 (159x109)</B></td>
<td id="td_cover">
  	<script type="text/javascript">
  	CMS.image_uplaod.show('{#$edit_data.cover_image1#}','{#$edit_data.cover_image2#}',
  	'{#$edit_data.cover_imagesize1#}','{#$edit_data.cover_imagesize2#}'); </script>
  	<BR/>
<input type="file" name="cover"> ( 支持：jpg,gif,jpeg,png)<label><input type="checkbox" name="cover_clear" value="1" />清除</label><br/></td></tr>
<tr id="tr_cover2"><td><B>Post event封面(159x109)</B></td>
<td id="td_cover2">
  	<script type="text/javascript">
  	CMS.image_uplaod.show('{#$edit_data.cover2_image1#}','{#$edit_data.cover2_image2#}',
  	'{#$edit_data.cover2_imagesize1#}','{#$edit_data.cover2_imagesize2#}'); </script>
  	<BR/>
<input type="file" name="cover2"> ( 支持：jpg,gif,jpeg,png)<label><input type="checkbox" name="cover2_clear" value="1" />清除</label><br/></td></tr>
<tr id="tr_member_type"><td><B>member_type</B></td>
<td id="td_member_type">{#$edit_data.member_type#}</td></tr>
<tr id="tr_points"><td><B>points</B></td>
<td id="td_points"><input id="field_points" type="text" name="points" value="{#$edit_data.points#}"></td></tr>
<tr id="tr_click"><td><B>人氣</B></td>
<td id="td_click"><input id="field_click" type="text" name="click" value="{#$edit_data.click#}"></td></tr>
<tr id="tr_likes"><td><B>likes</B></td>
<td id="td_likes"><input id="field_likes" type="text" name="likes" value="{#$edit_data.likes#}"></td></tr>
<tr id="tr_quota"><td><B>名額</B></td>
<td id="td_quota"><input id="field_quota" type="text" name="quota" value="{#$edit_data.quota#}"></td></tr>
<tr id="tr_apply_num"><td><B>申請人數</B></td>
<td id="td_apply_num"><input id="field_apply_num" type="text" name="apply_num" value="{#$edit_data.apply_num#}"></td></tr>
<tr id="tr_video"><td><B>video</B></td>
<td id="td_video"><input type="text" id="field_video" name="video"  size="80" value="{#$edit_data.video#}"></td></tr>
<tr id="tr_video_details"><td><B>video_details</B></td>
<td id="td_video_details"><textarea name="video_details" id="field_video_details" cols="60" rows="4">{#$edit_data.video_details#}</textarea></td></tr>
<tr id="tr_terms"><td><B>條款</B></td>
<td id="td_terms"><textarea name="terms" id="field_terms" cols="80" rows="6">{#$edit_data.terms#}</textarea></td></tr>
<tr id="tr_addedby"><td><B>建立者</B></td>
<td id="td_addedby">{#$edit_data.addedby#}</td></tr>
<tr id="tr_modifiedby"><td><B>更新者</B></td>
<td id="td_modifiedby">{#$edit_data.modifiedby#}</td></tr>
<tr id="tr_approvedby"><td><B>審核者</B></td>
<td id="td_approvedby">{#$edit_data.approvedby#}</td></tr>
<tr id="tr_status"><td><B>上線狀態</B></td>
<td id="td_status">{#$edit_data.status#}</td></tr>
<tr id="tr_addtime"><td><B>建立時間</B></td>
<td id="td_addtime">{#$edit_data.addtime#}</td></tr>
<tr id="tr_lastmodify"><td><B>更新時間</B></td>
<td id="td_lastmodify">{#$edit_data.lastmodify#}</td></tr>
  <tr>
    <td>&nbsp;</td>
    <td><input type="hidden" name="id" value="{#$edit_data.id#}">
     	
    <input type="hidden" name="action" value="update"><input name="subaction" type="hidden">
	<ul class="tableActions">
    
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 儲存 " onclick="form.subaction.value='edit_after_update'; form.submit();" type="button"></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" type="submit" name="Submit" value=" 確定 "></li>
  <li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="dummy" value=" 取消 " onclick="javascript:window.location.href='{#$self_url#}/list'" type="button"></li>  
<li><input class="psbutton" onmouseover="this.className='psbuttonhover'" onmouseout="this.className='psbutton'" name="Submit" value=" 刪除 " onclick="form.action.value='del'; form.submit();" type="button"></li>其他功能(請先儲存)：<a href="javascript:window.location.href='/cms/builder/event/photo.php/list/{#$edit_data.id#}'">Photo</a>
<a href="javascript:window.location.href='/cms/builder/event/application.php/list/{#$edit_data.id#}'">Application</a>

<a href="javascript:window.location.href='/cms/builder/event/question.php/list/{#$edit_data.id#}'">問題/選項</a>

<a href="javascript:window.location.href='/cms/builder/event/user.php/list/{#$edit_data.id#}'">用戶</a>

	</ul>
  </td>
  </tr>
</table>

</form> 

<script type="text/javascript">
$(function(){
  $(".tips").tipTip({defaultPosition: "right", edgeOffset: 10});
});
</script>

<script type="text/javascript">

function hidden_rows_by_type(type){

  var myArray = [
    [] ,   // show when value = 0
    ['body','content_json','bloggers'],  // show when value = 1
  ];

  for (var i=0; i<myArray.length; i++) {
    if (type == i){
       for (var j=0; j<myArray[i].length; j++){
         $('#tr_'+myArray[i][j]).show();
       }
    } else {
       for (var j=0; j<myArray[i].length; j++){
        $('#tr_'+myArray[i][j]).hide();
       }
    }
  }
}

$(document).ready(function() {	
	var type = parseInt($('[name|="has_detail"]').val());
	hidden_rows_by_type(type);

	$('[name|="has_detail"]').change(function() {
		hidden_rows_by_type(parseInt($(this).val()));
	});

});

</script>
<!--POSTRUNJS-->
</body>
</html>
